"""
Author : ZhengShiQi
DateTime: 2025/9/12 11:330
FileName: request_service.py
description: 处理API请求模拟的业务逻辑
"""
from sqlalchemy.orm import Session
from app.models.database import MockApiConfig
from app.models.schemas import MockApiCreate

def get_request_records(db: Session, skip: int = 0, limit: int = 100):
    """获取请求记录"""
    return db.query(MockApiConfig).offset(skip).limit(limit).all()

def create_request_record(db: Session, request: MockApiCreate):
    """创建请求记录"""
    db_request = MockApiConfig(**request.dict())
    db.add(db_request)
    db.commit()
    db.refresh(db_request)
    return db_request